<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class SmsSeedRequest extends Request
{
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        return [
            'mobile' =>[
                "required",
                "regex:/^(\+?0?86\-?)?((13\d|14[57]|15[^4,\D]|17[3678]|18\d)\d{8}|170[059]\d{7})$/",
                "unique:users",
            ]
        ];
    }

    public function messages()
    {
        return [
            'mobile.required' => '手机号码必须填写',
            'mobile.regex' => '手机号码格式错误',
            'mobile.unique'=> '该手机号已被注册'
        ];
    }
}
